package com.homework.dao;

import com.homework.model.User;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.Connection;
import java.sql.PreparedStatement;

/**
 * @desc:
 * @author: Ping
 * @date: 2024/9/17 23:35
 */

@Repository
public class UserDao {
    @Autowired
    private Connection conn ;

    public int insert(User user) {
        /**
         * todo: 写出对应的sql
         */
        String sql = "" ;
        try (
                PreparedStatement ps =  conn.prepareStatement(sql) ;
                ){

        } catch (Exception e) {
            /**
             * todo: 异常输出
             */
        }
        return 0 ;
    }

    /**
     * todo: 实现登录
     * @param name
     * @param password
     * @return
     */
    public User login(String name, String password) {
        return null ;
    }

    /**
     * todo: 统计所有的用户数
     * @return
     */
    public int countAllUsers() {
        return 0 ;
    }

}
